home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEV
/
C-H
/
CMacPrimer.cpt
/
ShowPICT ƒ
/
showPICT.c
< prev
Wrap
C/C++ Source or Header
|
1989-12-16
|
1KB
|
73 lines
#define BASE_RES_ID 400
#define NIL_POINTER 0L
#define MOVE_TO_FRONT -1L
#define REMOVE_ALL_EVENTS 0
PicHandle gThePicture;
WindowPtr gPictureWindow;
main()
{
ToolBoxInit();
WindowInit();
LoadPicture();
DrawMyPicture(gThePicture, gPictureWindow);
while(!Button());
}
ToolBoxInit()
{
InitGraf(&thePort);
InitFonts();
FlushEvents(everyEvent,REMOVE_ALL_EVENTS);
InitWindows();
InitMenus();
TEInit();
InitDialogs(NIL_POINTER);
InitCursor();
}
WindowInit()
{
gPictureWindow = GetNewWindow(BASE_RES_ID,NIL_POINTER,
MOVE_TO_FRONT);
ShowWindow(gPictureWindow);
SetPort(gPictureWindow);
}
LoadPicture()
{
gThePicture = GetPicture(BASE_RES_ID);
}
DrawMyPicture(thePicture, pictureWindow)
PicHandle thePicture;
WindowPtr pictureWindow;
{
Rect myRect;
myRect = pictureWindow->portRect;
CenterPict(thePicture, &myRect);
DrawPicture(thePicture, &myRect);
}
CenterPict(thePicture, myRectPtr)
PicHandle thePicture;
Rect *myRectPtr;
{
Rect windRect, pictureRect;
windRect= *myRectPtr;
pictureRect = (**(thePicture)).picFrame;
myRectPtr->top = (windRect.bottom - windRect.top -
(pictureRect.bottom - pictureRect.top))/2 +
windRect.top;
myRectPtr->bottom = myRectPtr->top +
(pictureRect.bottom - pictureRect.top);
myRectPtr->left = (windRect.right - windRect.left -
(pictureRect.right - pictureRect.left))/2 +
windRect.left;
myRectPtr->right = myRectPtr->left + (pictureRect.right -
pictureRect.left);
}